package com.easemob.chatuidemo.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.LinearLayout;

import com.easemob.chatuidemo.R;
import com.easemob.chatuidemo.fragment.AboutFragment;
import com.easemob.chatuidemo.fragment.MessageToRemindFragment;
import com.easemob.chatuidemo.fragment.MiscellaneousFunctionFragment;
import com.easemob.chatuidemo.fragment.PrivacyFragment;

/**
 * Created by lanou3g on 15/9/16.
 */
public class SettingActivity extends Activity implements View.OnClickListener {

    /**
     * 声明
     **/

    private MessageToRemindFragment messageToRemindFragment;
    private MiscellaneousFunctionFragment miscellaneousFunctionFragment;
    private PrivacyFragment privacyFragment;
    private AboutFragment aboutFragment;

    // 数组索引
    private int index;
    // Fragment类型数组
    private Fragment[] fragments;

    private LinearLayout linearLayoutMessageToReMind, linearLayoutMiscellaneousFunction, linearLayoutprivacy, linearLayoutAbout, linearLayoutSetting;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_setting);



        init();

    }

    /**
     * 初始化
     **/
    public void init() {

        linearLayoutMessageToReMind = (LinearLayout) findViewById(R.id.ll_msg_to_remind);
        linearLayoutMiscellaneousFunction = (LinearLayout) findViewById(R.id.ll_miscellaneous_function);
        linearLayoutprivacy = (LinearLayout) findViewById(R.id.ll_privacy);
        linearLayoutAbout = (LinearLayout) findViewById(R.id.ll_about);
        linearLayoutSetting = (LinearLayout) findViewById(R.id.ll_setting);

        fragments = new Fragment[]{messageToRemindFragment, miscellaneousFunctionFragment, privacyFragment, aboutFragment};

        // 设置监听
        linearLayoutMessageToReMind.setOnClickListener(this);
        linearLayoutMiscellaneousFunction.setOnClickListener(this);
        linearLayoutprivacy.setOnClickListener(this);
        linearLayoutAbout.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {

        switch (view.getId()) {
            case R.id.ll_msg_to_remind:

                Intent msg = new Intent(this,SettingsActivity.class);

                msg.putExtra("index",0);

                startActivity(msg);

                break;
            case R.id.ll_miscellaneous_function:
                Intent function = new Intent(this,SettingsActivity.class);

                function.putExtra("index",1);

                startActivity(function);
                break;
            case R.id.ll_privacy:
                Intent privacy = new Intent(this,SettingsActivity.class);

                privacy.putExtra("index",2);

                startActivity(privacy);
                break;
            case R.id.ll_about:
                Intent about = new Intent(this,SettingsActivity.class);

                about.putExtra("index",3);

                startActivity(about);

                break;





        }
    }


}

